Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Text.​Json.​Serialization.​JsonConverter<​T>

Assembly: System.Text.Json

Inheritance: object → JsonConverter → JsonConverter

Converts an object or value to or from JSON.

Properties

public bool
HandleNull
Gets a value that indicates whether <see langword="null" /> should be passed to the converter on serialization, and whether <see cref="F:System.Text.Json.JsonTokenType.Null" /> should be passed on deserialization.
public Type
Type
Gets the type being converted by the current converter instance.

Methods

public bool
CanConvert​(Type typeToConvert)
Determines whether the specified type can be converted.
Returns <see langword="true" /> if the type can be converted; otherwise, <see langword="false" /> .
typeToConvert The type to compare against.
public T
Read​(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
public T
ReadAsPropertyName​(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
public void
Write​(Utf8JsonWriter writer, T value, JsonSerializerOptions options)
Writes a specified value as JSON.
writer The writer to write to.
value The value to convert to JSON.
options An object that specifies serialization options to use.
public void
WriteAsPropertyName​(Utf8JsonWriter writer, T value, JsonSerializerOptions options)
Writes a dictionary key as a JSON property name.
writer The <see cref="T:System.Text.Json.Utf8JsonWriter" /> to write to.
value The value to convert. The value of <see cref="P:System.Text.Json.Serialization.JsonConverter`1.HandleNull" /> determines if the converter handles <see langword="null" /> values.
options The options to use when writing the value.
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object